home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / rsxwdk2s.zip / RSXWDK / LIBSRC / DOS / DOS3C.C < prev    next >
C/C++ Source or Header  |  1994-12-17  |  480b  |  29 lines

  1. #include <errno.h>
  2. #include <sys/doscalls.h>
  3.  
  4.  
  5. /*
  6. ** AH = 0x3C
  7. ** CX = attr
  8. ** DS:DX = name
  9. ** return: AX fileno
  10. */
  11. int dos_creat(const char *name, int attr)
  12. {
  13.     struct REGPACK r;
  14.     struct SEGPACK sr = { GetDS(), GetES()};
  15.  
  16.     r.eax = 0x3C00;
  17.     r.ecx = attr;
  18.     SET_SEG_OFF(name, sr.ds, r.edx);
  19.  
  20.     _intxr(0x21, &r, &sr);
  21.  
  22.     if (r.eflags & 1) {
  23.     _sys_doserror2errno( r.eax & 0xFFFF);
  24.     return (-1);
  25.     }
  26.     else
  27.     return (r.eax & 0xFFFF);
  28. }
  29.